using STHPMS1.ICore;
using STHPMS1.ICore.I_Common;
using STHPMS1.ICore.I_Core;
using STHPMS1.ICore.I_DAL;

namespace STHPMS1.DAL.D_Core
{
	public class DalModule : DisposeObject //, IModule
	{
		public static void Init ()
		{
			System.Diagnostics.Debug.WriteLine ("DalModule");
			IDalFactory factory = new DalFactory ();
			IDalFacade facade = new DalFacade ();
			MyApp.Locator.AddBuilder<IObjectFactory> (() => factory, TypeStringDefinition.DALFACTORY);
			MyApp.Locator.AddBuilder<IFacade> (() => facade, TypeStringDefinition.DALFACADE);
			MyApp.Locator.AddBuilder<IDalFactory> (() => new DalFactory ());
			MyApp.Locator.AddBuilder<IDalFacade> (() => new DalFacade ());
		}

		protected override void OnDispose ()
		{
			MyApp.Locator.RemoveBuidler<IObjectFactory> (TypeStringDefinition.DALFACTORY);
			MyApp.Locator.RemoveBuidler<IFacade> (TypeStringDefinition.DALFACADE);
			MyApp.Locator.RemoveBuidler<IDalFactory> ();
			MyApp.Locator.RemoveBuidler<IDalFacade> ();
		}
	}
}
